use std::{thread::{self, sleep}, time::Duration};


fn main() {
    println!("Hello, world!");

    let handle = thread::spawn(|| {
        for i in 1..10 {
            println!("other thread {}", i);
            sleep(Duration::from_millis(10));
        }
    });

    for i in 1..=5 {
        println!("main thread {}", i);
        sleep(Duration::from_millis(10));
    }

    // 不调用 join ， 在父线程结束时，子线程也就结束了
    handle.join().unwrap();
}
